home *** CD-ROM | disk | FTP | other *** search
-
- Example3.c
- ==========
-
- The function of this example is similiar to Example2, only now the
- example is based on inheritance.
-
- The MATH_aClass will be the superclass of the others.
-
- How it works
- ------------
-
- One thing that is very different is the "math_a.instance" file.
- This represents the instance of the MATH_aClass superclass. If we
- define a class with MATH_aClass as superclass we must include this
- file in the instance. The math_xy_Instance uses besides the
- "math_a.instance" another item (LONG Y). The "math_a.instance" file
- is in this example stored in the current directory, the instances
- of public
-
- The main() function has been slightly changed. Important is to _first_
- fully define the superclass (MATH_aClass). After this the other
- classes can be defined. The BST_MakeClass is replaced by the
- BST_MakeSubClass function.
- Now we only have to add the 'override' methods.
-
- The classes
- -----------
-
- The MATH_aClass class is the biggest class, this class is the superclass
- of the others.
-
- mth_a_Init - Just sets the instance A to 1.
- mth_a_InputX - Builds a TagList containing a BTA_Y tag with the instance
- A, this TagList is send to the method connected to the
- OBM_OUTPUT method of this object.
- mth_a_OutputX - Just triggers the OBM_INPUT of this object.
- mth_a_SetAttr - The set attribute function..uhm... to set just the A instance
- field.
-
- The other classes are subclasses of the MATH_aClass and are therefore much
- smaller.
-
- MATH_x2Class:
-
- mth_x2_InputX - This is the only 'overiden' method, this because now the class
- must 'output' the TagList with the A*X*X formula.
- VERY IMPORTANT!: the MTHF_BREAK flag, this flag tells the beast
- engine that _no more_ routines of _this_ method must be called.
- If this flag isn't set the OBM_INPUT method routine of the
- MATH_aClass is called again !!!... but sometimes this could be
- just the thing you want. The methods of the subclasses are always
- called first. In the new versions of the beast.library it will be
- possible to queue the methods.
-
- MATH_xClass:
-
- mth_x_InputX - The same story as for mth_x2_InputX, only now the formula is
- A*X.
-
- MATH_xyClass:
- This class has three method overides.
-
- mth_xy_Init - Set the Y instance to 0, please NOTE(!) that the MTHF_BREAK flag
- is not there, this because the mth_a_Init is also neccesary to set
- the A instance.
- mth_xy_InputY - This method will calculate the result just as in BST_Example2.
- mth_xy_OutputY - The starting method as in BST_Example2.
-
-
-
-